import java.util.Scanner;

/**
 * 
 */

/**
 * @author terratack
 *
 */
public class Human {
	/**
	 * @param cards_Amount ilosc kart, ktore gracz chce wymienic zapisana w String
	 */
	String cards_Amount;
	/**
	 * @param int_cards_Amount zmienna pomocnicza potrzebna do rzutowania zmiennej cards_Amount
	 */
	int int_cards_Amount;
	private Scanner sys_In;
	
	public void change_Card(int j) throws Exception{
		System.out.println("Masz " + Poker.player[j].coins + " Pieniedzy");
		System.out.println("Ile kart do wymiany?: ");
		sys_In = new Scanner(System.in);
		String card;
		int icard;
		cards_Amount = sys_In.nextLine();
		try{
		int_cards_Amount = Integer.parseInt(cards_Amount);
		}
		catch(NumberFormatException ex){
			System.out.println("nie podales poprawnej liczby, nic nie wymienie");
			int_cards_Amount = 0;
		}
		if(int_cards_Amount > 4 || int_cards_Amount < 0) throw new Exception(); 
		if(int_cards_Amount > 0){
			for(int i = 0; i < int_cards_Amount; i++){
				System.out.println("Podaj numer karty do wymiany: ");
				card = sys_In.nextLine();
				try{
				icard = Integer.parseInt(card);
				Poker.player[j].cards_in_hand[icard] = Poker.deck.game_deck[Poker.table.help];
				Poker.table.help++;
				}
				catch(NumberFormatException ex){
					System.out.println("podaj odpowiednia liczbe z przedzialu 0 - 4");
					i--;
				}
			}
		}
	}
}
